﻿using Newtonsoft.Json;
using System;
using System.ComponentModel;
using System.ComponentModel.DataAnnotations.Schema;
using YiSha.Util;

namespace YiSha.Entity.OrganizationManage
{
    [Table("SysUser")]
    public class UserEntity : BaseExtensionEntity
    {
        /// <summary>
        /// 用户名
        /// </summary>
        [Description("用户名")]
        public string UserName { get; set; }

        /// <summary>
        /// 密码
        /// </summary>
        public string Password { get; set; }

        /// <summary>
        /// 加密盐
        /// </summary>
        [JsonIgnore]
        public string Salt { get; set; }

        /// <summary>
        /// 真实姓名
        /// </summary>
        [Description("真实姓名")]
        public string RealName { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        [Description("性别")]
        public int? Gender { get; set; }

        /// <summary>
        /// 出生日期
        /// </summary>
        public string Birthday { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        public string Portrait { get; set; }

        /// <summary>
        /// 电子邮件
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 手机号码
        /// </summary>
        [Description("手机号")]
        public string Mobile { get; set; }

        /// <summary>
        /// qq
        /// </summary>
        public string QQ { get; set; }

        /// <summary>
        /// 微信
        /// </summary>
        public string Wechat { get; set; }

        /// <summary>
        /// 登录次数
        /// </summary>
        public int? LoginCount { get; set; }

        /// <summary>
        /// 用户状态
        /// </summary>
        public int? UserStatus { get; set; }

        /// <summary>
        /// 是否是系统用户
        /// </summary>
        public int? IsSystem { get; set; }

        /// <summary>
        /// 是否在线
        /// </summary>
        public int? IsOnline { get; set; }

        /// <summary>
        /// 第一次登录时间
        /// </summary>
        public DateTime? FirstVisit { get; set; }

        /// <summary>
        /// 上次登录时间
        /// </summary>
        public DateTime? PreviousVisit { get; set; }

        /// <summary>
        /// 最后登录时间
        /// </summary>
        public DateTime? LastVisit { get; set; }

        /// <summary>
        /// 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// web Token
        /// </summary>
        public string WebToken { get; set; }

        /// <summary>
        /// API token
        /// </summary>
        public string ApiToken { get; set; }

        /// <summary>
        /// 部门ID
        /// </summary>
        [JsonConverter(typeof(StringJsonConverter))]
        public long? DepartmentId { get; set; }

        /// <summary>
        /// 部门名称
        /// </summary>
        [NotMapped]
        public string DepartmentName { get; set; }

        /// <summary>
        /// 岗位Id
        /// </summary>
        [NotMapped]
        public string PositionIds { get; set; }

        /// <summary>
        /// 角色Id
        /// </summary>
        [NotMapped]
        public string RoleIds { get; set; }
    }
}